package com.maple.soa.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author lijian
 * @date 2020/7/20
 */
@RestController
@RequestMapping("/upload")
@Slf4j
public class UploadController {

    @RequestMapping("/index")
    public String index(@RequestParam("file") MultipartFile file) {
        System.out.println(file.getName());
        String fileName = file.getOriginalFilename();
        long size = file.getSize();
        String contentType = file.getContentType();
        log.info("upload file: {}, file size: {}, content-type: {}", fileName, size, contentType);

        return "上传成功";
    }

}
